<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var cal = function(i){
				var num1 = document.getElementById("num1").value;
				var num2 = document.getElementById("num2").value;				
				document.getElementById("num3").value=eval(num1+i+num2);
			}
		</script>
	</head>
	<body>
		第一个数：<input type="text"  id="num1" /><br>
		第二个数：<input type="text"  id="num2" /><br>
		<button onclick="cal('+')">+</button>
		<button onclick="cal('-')">-</button>
		<button onclick="cal('*')">*</button>
		<button onclick="cal('/')">/</button><br>
	     计算结果：<input type="text"  id="num3" /><br>
	</body>
</html>
